-
-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Fix #67] Fix an error for Performance/RedundantMerge
#68
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fixes rubocop#67. This PR fixes an error for `Performance/RedundantMerge` when `MaxKeyValuePairs` option is set to `null`. ```yaml require: rubocop-performance Performance/RedundantMerge: Enabled: true MaxKeyValuePairs: null ``` ```console % bundle exec rubocop --only Performance/RedundantMerge -d For /private/tmp/67: configuration from /private/tmp/67/.rubocop.yml configuration from /Users/koic/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rubocop-performance-1.4.0/config/default.yml configuration from /Users/koic/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rubocop-performance-1.4.0/config/default.yml Default configuration from /Users/koic/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rubocop-0.72.0/config/default.yml Inspecting 2 files Scanning /private/tmp/67/Gemfile .Scanning /private/tmp/67/example.rb An error occurred while Performance/RedundantMerge cop was inspecting /private/tmp/67/example.rb:23:2. can't convert nil into Integer /Users/koic/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rubocop-performance-1.4.0/lib/rubocop/cop/performance/redundant_merge.rb:135:in `Integer' /Users/koic/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rubocop-performance-1.4.0/lib/rubocop/cop/performance/redundant_merge.rb:135:in `max_key_value_pairs' /Users/koic/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rubocop-performance-1.4.0/lib/rubocop/cop/performance/redundant_merge.rb:74:in `non_redundant_pairs?' /Users/koic/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rubocop-performance-1.4.0/lib/rubocop/cop/performance/redundant_merge.rb:68:in `non_redundant_merge? ``` As with `Width` option of `IndentationWidth` cop, value of default.yml is specified as the default value. - /~https://github.com/rubocop-hq/rubocop-performance/blob/v1.4.0/lib/rubocop/cop/performance/redundant_merge.rb#L131 - /~https://github.com/rubocop-hq/rubocop/blob/v0.72.0/config/default.yml#L794-L801
koic
force-pushed
the
fix_an_error_for_redundant_merge
branch
from
July 11, 2019 08:06
2438cb2
to
e286f25
Compare
@koic Shouldn't the - Integer(cop_config['MaxKeyValuePairs']) || 2
+ Integer(cop_config['MaxKeyValuePairs'] || 2) This way |
koic
added a commit
to koic/rubocop-performance
that referenced
this pull request
Jul 30, 2019
Follow up rubocop#68 (comment). rubocop#68 didn't solve an issue rubocop#67 with `Performance/RedundantMerge`. This PR is corrected by adding a reproduction test.
8 tasks
This is my mistake 💦 I opened a PR #74. Thanks! |
You're welcome @koic |
koic
added a commit
to koic/rubocop-performance
that referenced
this pull request
Jul 30, 2019
Follow up rubocop#68 (comment). rubocop#68 didn't solve an issue rubocop#67 with `Performance/RedundantMerge`. This PR is corrected by adding a reproduction test.
patrickm53
pushed a commit
to patrickm53/performance-develop-rubyonrails
that referenced
this pull request
Sep 23, 2022
Follow up rubocop/rubocop-performance#68 (comment). #68 didn't solve an issue #67 with `Performance/RedundantMerge`. This PR is corrected by adding a reproduction test.
richardstewart0213
added a commit
to richardstewart0213/performance-build-Performance-optimization-analysis-
that referenced
this pull request
Nov 4, 2022
Follow up rubocop/rubocop-performance#68 (comment). #68 didn't solve an issue #67 with `Performance/RedundantMerge`. This PR is corrected by adding a reproduction test.
Cute0110
added a commit
to Cute0110/Rubocop-Performance
that referenced
this pull request
Sep 28, 2023
Follow up rubocop/rubocop-performance#68 (comment). #68 didn't solve an issue #67 with `Performance/RedundantMerge`. This PR is corrected by adding a reproduction test.
SerhiiMisiura
added a commit
to SerhiiMisiura/Rubocop-Performance
that referenced
this pull request
Oct 5, 2023
Follow up rubocop/rubocop-performance#68 (comment). #68 didn't solve an issue #67 with `Performance/RedundantMerge`. This PR is corrected by adding a reproduction test.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #67.
This PR fixes an error for
Performance/RedundantMerge
whenMaxKeyValuePairs
option is set tonull
.As with
Width
option ofIndentationWidth
cop, value of default.ymlis specified as the default value.
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).and description in grammatically correct, complete sentences.
bundle exec rake default
. It executes all tests and RuboCop for itself, and generates the documentation.